<?php
	include "common.php";
	session_start();
	error_reporting(0);
	if($_SESSION['logInCheck']!=1){
		header('Location: index.php?loginInfo=false');
	}
	$userLink = $_SESSION['userLink'];
	if($userLink!="hrpage.php"){
		echo "Sorry, You have no right to visit this page!!";
		exit;
	}
	$eid = $_SESSION['id'];
	$userFname = $_SESSION['userFname'];
	$userLname = $_SESSION['userLname'];
	$role = $_SESSION['role'];
	
	$userSql = "SELECT * FROM user WHERE e_id = '$eid'";
	$userSqlQuery = mysql_query($userSql);
	$userSqlResult = mysql_fetch_assoc($userSqlQuery);
	
	$email = $userSqlResult['email'];
	$timezone_offset = 6; // for getting local time offset hrs
	$systemDate = gmdate('y-m-d', time()+$timezone_offset*60*60);
	$compToday = strtotime($systemDate);
	
	$searchSql = "SELECT * FROM user WHERE status = 0";
	$searchSqlQuery = mysql_query($searchSql);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="index.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="show_report.css" />
<link rel="icon" type="image/ico" href="images/favicon.ico"></link> 
<link rel="shortcut icon" href="images/favicon.ico"></link>
<script src="curvycorners.src.js" type="text/javascript"></script>
<script src="login.js" type="text/javascript"></script>
<title><?php echo "Welcome to ".$userFname." ".$userLname; ?></title>
</head>

<body>
<div class="main_div_other">
	<p><img src="images/creato_logo.jpg" /></p>
    <p id="creatobd">www.creatobd.com</p>
    <p id="date"><script>document.write(new_month+" "+new_date+", "+old_date.getFullYear()+" || "+new_day);</script></p>
    <div class="other_page_icons">
    	<div class="new_notification">
        	<img src="images/arrow_up.JPG" /><p>You have a new notification</p>
        </div><!--end of new_notification-->
    	<ul>
        	<a href="hrpage.php"><li><div id="home"></div><p>home</p><p class="present_class"><img src="images/arrow_up.JPG" /></p></li></a>
            <a href="hr_employee.php"><li><div id="employee"></div><p>employee</p><p class="present_class"><img src="images/arrow_up.JPG" /></p></li></a>
            <a href="hr_onduty.php"><li><div id="onduty"></div><p>on duty</p><p class="present_class"><img src="images/arrow_up.JPG" /></p></li></a>
            <a href="hr_attendance.php"><li><div id="attendance"></div><p>attendance</p><p class="present_class"><img src="images/arrow_up.JPG" /></p></li></a>
            <a href="hr_leave.php"><li><div id="leave"></div><p>leave</p><p class="present_class"><img src="images/arrow_up.JPG" /></p></li></a>
            <a href="hr_notification.php"><li><div id="notification"></div><p>notification</p><p class="present_class"><img src="images/arrow_up.JPG" /></p></li></a>
            <a href="hr_black_box_message.php"><li><div id="blackbox"></div><p>black box</p><p class="present_class"><img src="images/arrow_up.JPG" /></p></li></a>
            <a href="#"><li><div id="hrpolicy"></div><p>hr policy</p><p class="present_class"><img src="images/arrow_up.JPG" /></p></li></a>
            <a href="index.php"><li><div id="logout"></div><p>log out</p><p class="present_class"><img src="images/arrow_up.JPG" /></p></li></a>
        </ul>
    </div><!-- end of other_page_icons-->
    
</div><!-- end of main_div_other-->
<div class="othrpage_1">
    <p>view as: <a href="hr_employee_lists.php">lists</a> | <a href="update_user.php">add</a> | <a href="up_user.php">Update</a></p>
</div><!-- end of othrpage_1-->
<form action="up_user.php" method="post">
		<table cellpadding="0" cellspacing="0"  align="center" class="apply4leave_table hrpage_info_table">
			<tr valign="top">
				<td><p style="margin-top:6px; font-weight:bold;">Select Name</p></td> 
				<td>
					<select name="id">
					<?php 
						while ($data = mysql_fetch_assoc($searchSqlQuery))
						{
					?>
						<option value="<?php echo $data['e_id'];?>"><?php echo $data['f_name']." ".$data['l_name'];?></option>
					<?php	
						}
					?>
					</select>
					<input type="submit" value="Update" style="padding:5px 10px; background:#57c257; color:#FFF; cursor:pointer; border:0px;"/>
					<input type="hidden" value="1" name="check"/>
				</td>
			</tr>
		</table>
	</form>
	<?php
		$checkSubmit = $_POST['check'];
		$eId  = $_POST['id'];
		
		if ($checkSubmit == 1)
		{
			$updateUserSql = "SELECT * FROM user WHERE e_id = '$eId'";
			$updateUserSqlQuery = mysql_query($updateUserSql);
			$userData = mysql_fetch_assoc($updateUserSqlQuery);
	?>
			<form action="get_up_user.php" method="post">
				<table cellpadding="0" cellspacing="0" class="apply4leave_table hrpage_info_table" style="margin:0 auto; margin-top:20px;" align="center">
					<tr valign="top">
						<td  class="add_user_td1">Employee Id</td>
						<td><input type="text" value="<?php echo $userData['e_id'];?>" name="id" /></td>
						<td style="width:10px; background:#eff2f6; padding:0px !important;">&nbsp;</td>
					</tr>
					<tr valign="top">
						<td  class="add_user_td1">Role</td>
						<td><input type="text" name="role" value="<?php echo $userData['role'];?>"/></td>
						<td style="width:10px; background:#eff2f6; padding:0px !important;">&nbsp;</td>
					</tr>
					<tr valign="top">
						<td  class="add_user_td1">First Name</td>
						<td><input type="text" value="<?php echo $userData['f_name'];?>" name="fName" /></td>
						<td style="width:10px; background:#eff2f6; padding:0px !important;">&nbsp;</td>
					</tr>
					<tr>
						<td  class="add_user_td1">Last name</td>
						<td><input type="text" value="<?php echo $userData['l_name'];?>" name="lName" /></td>
						<td style="width:10px; background:#eff2f6; padding:0px !important;">&nbsp;</td>
					</tr>
					<tr valign="top">
						<td  class="add_user_td1">Email</td>
						<td><input type="text" name="email" value="<?php echo $userData['email'];?>"/></td>
						<td style="width:10px; background:#eff2f6; padding:0px !important;">&nbsp;</td>
					</tr>
					<tr valign="top">
						<td  class="add_user_td1">Password</td>
						<td><input type="password" name="pass" value="<?php echo $userData['password'];?>"/></td>
						<td style="width:10px; background:#eff2f6; padding:0px !important;">&nbsp;</td>
					</tr>
					<tr valign="top">
						<td  class="add_user_td1">Contact1</td>
						<td><input type="text" name="con1" value="<?php echo $userData['contact1'];?>"/></td>
						<td style="width:10px; background:#eff2f6; padding:0px !important;">&nbsp;</td>
					</tr>
					<tr valign="top">
						<td  class="add_user_td1">Contact2</td>
						<td><input type="text" name="con2" value="<?php echo $userData['contact2']?>"/></td>
						<td style="width:10px; background:#eff2f6; padding:0px !important;">&nbsp;</td>
					</tr>
					<tr valign="top">
						<td class="add_user_td1">Supervisor</td>
						<td><input type="text" name="super" value="<?php echo $userData['supervisor'];?>"/></td>
						<td style="width:10px; background:#eff2f6; padding:0px !important;">&nbsp;</td>
					</tr>
					<tr valign="top">
						<td class="add_user_td1">Address</td>
						<td><input type="text" name="add" value="<?php echo $userData['address'];?>"/></td>
						<td style="width:10px; background:#eff2f6; padding:0px !important;">&nbsp;</td>
					</tr>
					<tr valign="top">
						<td class="add_user_td1">Blood Group</td>
						<td><input type="text" name="blood" value="<?php echo $userData['blood_group'];?>"/></td>
						<td style="width:10px; background:#eff2f6; padding:0px !important;">&nbsp;</td>
					</tr>
					<tr valign="top">
						<td class="add_user_td1">Joining Date</td>
						<td><input type="text" name="j_date" value="<?php echo $userData['j_date'];?>"/></td>
						<td style="width:10px; background:#eff2f6; padding:0px !important;">&nbsp;</td>
					</tr>
					<tr valign="top">
						<td class="add_user_td1">Department ID</td>
						<td><input type="text" name="dept_id" value="<?php echo $userData['dept_id'];?>"/></td>
						<td style="width:10px; background:#eff2f6; padding:0px !important;">&nbsp;</td>
					</tr>
					<tr valign="top">
						<td class="add_user_td1">Status</td>
						<td><input type="text" name="status" value="<?php echo $userData['status'];?>"/></td>
						<td style="width:10px; background:#eff2f6; padding:0px !important;">&nbsp;</td>
					</tr>
					<tr><td colspan="3"><p class="submit_button_add_user"><input type="submit" value="Submit" /></p></td></tr>
				</table>
			</form>
	<?php
		}				
	?>
<div class="human_portal">
  		<p>creato human resourse portal</p>
</div><!-- end of human_portal-->

</body>
</html>
